package com.abc.recycling.service;

import com.abc.recycling.model.Order;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

public interface CollectorOrderService {
    // 订单查询
    Page<Order> getOrdersByCollectorId(Long collectorId, Pageable pageable);
    Page<Order> getOrdersByCollectorAndStatus(Long collectorId, String status, Pageable pageable);
    Page<Order> getCollectorOrderHistory(Long collectorId, Pageable pageable);
    Page<Order> getOrdersByStatus(String status, Pageable pageable);
    
    // 订单统计
    long countOrdersByCollector(Long collectorId);
    long countCompletedOrdersByCollector(Long collectorId);
    long countOrdersByCollectorAndStatus(Long collectorId, String status);
    long countOrdersByCollectorAndDate(Long collectorId, LocalDateTime date);
    long countOrdersByStatus(String status);
    
    // 收入和重量统计
    double getCollectorMonthlyIncome(Long collectorId);
    double getCollectorTotalWeight(Long collectorId);
    
    // 数据分析
    List<Map<String, Object>> getOrderTrendByCollector(Long collectorId);
    Map<String, Long> getItemDistributionByCollector(Long collectorId);
    Map<String, Long> getCollectorOrderStats(Long collectorId);
    Map<String, Object> getCollectorEvaluationStats(Long collectorId);

    /**
     * 回收员接单
     * @param orderId 订单ID
     * @param collectorId 回收员ID
     * @return 是否接单成功
     */
    boolean acceptOrder(Long orderId, Long collectorId);

    /**
     * 回收员完成订单
     * @param orderId 订单ID
     * @param collectorId 回收员ID
     * @param actualWeight 实际重量
     * @param price 回收价格
     * @return 是否完成成功
     */
    boolean completeOrder(Long orderId, Long collectorId, Double actualWeight, Double price);
} 